package com.huawei.appmarket.service.store.awk.card;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import com.huawei.appgallery.foundation.card.base.card.BaseDistCard;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.store.awk.bean.HorizontalCourseItemCardBean;
import huawei.widget.HwTextView;
import java.lang.ref.WeakReference;
import o.azb;
import o.ces;
import o.cet;
import o.ceu;
import o.cgz;
import o.chy;
import o.cil;
import o.cim.a;
import o.eim;
import o.eio;
import o.eqx;
import o.evx;
import o.ewm.j;

public class CourseListCard extends BaseDistCard {
    private boolean ʻ = false;
    private HwTextView ʼ;
    private ImageView ʽ;
    private LinearLayout ˋ;
    private HwTextView ॱॱ;
    private View ᐝ;

    static class d implements ces {
        WeakReference<Context> ˋ;
        WeakReference<chy> ˎ;
        CourseListCard ˏ;
        WeakReference<HorizontalCourseItemCardBean> ॱ;

        d(HorizontalCourseItemCardBean horizontalCourseItemCardBean, chy o_chy, Context context) {
            this.ॱ = new WeakReference(horizontalCourseItemCardBean);
            this.ˎ = new WeakReference(o_chy);
            this.ˋ = new WeakReference(context);
            this.ˏ = new CourseListCard(context);
            this.ˏ.ˊᐝ = horizontalCourseItemCardBean;
        }

        public void onResult(int i) {
            HorizontalCourseItemCardBean horizontalCourseItemCardBean = (HorizontalCourseItemCardBean) this.ॱ.get();
            if (horizontalCourseItemCardBean != null) {
                eio.ˊ(i, horizontalCourseItemCardBean.ʼˊ());
            }
            CourseListCard.ˋ(i, (chy) this.ˎ.get(), (HorizontalCourseItemCardBean) this.ॱ.get(), (Context) this.ˋ.get(), this.ˏ);
        }
    }

    public /* synthetic */ CardBean ˌ() {
        return ᐝ();
    }

    public boolean ˊ() {
        return this.ʻ;
    }

    public void ॱ(boolean z) {
        this.ʻ = z;
    }

    protected LinearLayout ˎ() {
        return this.ˋ;
    }

    protected View ˋ() {
        return this.ᐝ;
    }

    public CourseListCard(Context context) {
        super(context);
    }

    public HorizontalCourseItemCardBean ᐝ() {
        if (this.ˊᐝ instanceof HorizontalCourseItemCardBean) {
            return (HorizontalCourseItemCardBean) this.ˊᐝ;
        }
        return null;
    }

    public cgz ˏ(View view) {
        this.ˋ = (LinearLayout) view.findViewById(j.ˉᐝ);
        this.ʽ = (ImageView) view.findViewById(j.ˈᐝ);
        this.ʼ = (HwTextView) view.findViewById(j.ˊˉ);
        this.ॱॱ = (HwTextView) view.findViewById(j.ˉˊ);
        this.ᐝ = view.findViewById(j.ᐧᐝ);
        ʽ(view);
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof HorizontalCourseItemCardBean) {
            LayoutParams layoutParams = (LayoutParams) this.ˋ.getLayoutParams();
            layoutParams.setMarginStart(ʼ());
            layoutParams.setMarginEnd(ॱॱ());
            this.ᐝ.setVisibility(ˊᐝ() ? 0 : 4);
            HorizontalCourseItemCardBean horizontalCourseItemCardBean = (HorizontalCourseItemCardBean) cardBean;
            eqx.ˏ(this.ʽ, horizontalCourseItemCardBean.ʻˋ(), "image_default_icon");
            this.ʽ.setContentDescription(horizontalCourseItemCardBean.v_());
            this.ʼ.setText(horizontalCourseItemCardBean.v_());
            this.ॱॱ.setText(eim.ˏ(horizontalCourseItemCardBean.ʼˋ(), horizontalCourseItemCardBean));
        }
    }

    private int ʼ() {
        return azb.ˊ(this.ˊˋ.getContext());
    }

    private int ॱॱ() {
        return azb.ˏ(this.ˊˋ.getContext());
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass3 = new evx(this) {
            final /* synthetic */ CourseListCard ˎ;

            public void ˋ(View view) {
                new ceu((Activity) this.ˎ.ʼॱ).ˊ(new cet("com.huawei.educenter", "educenter", 10000000), new d(this.ˎ.ᐝ(), o_chy, this.ˎ.ʼॱ));
            }
        };
        this.ʽ.setOnClickListener(anonymousClass3);
        ˉ().setOnClickListener(anonymousClass3);
    }

    private static void ˋ(int i, chy o_chy, HorizontalCourseItemCardBean horizontalCourseItemCardBean, Context context, CourseListCard courseListCard) {
        if (i == 2000 || i == 2001 || i == 2002) {
            o_chy.ˏ(0, courseListCard);
        } else if (i == 2100 || i == 2101 || i == 2102 || i == 2103 || i == 2200 || i == 2201 || i == 2202 || i == 2300 || i == 2301) {
            cil.ˋ(context, new a(courseListCard.ᐝ()).ˋ());
        }
    }
}
